<template>
  <div>
    <div class="head">
      <p class="text">应用</p>
      <van-icon
        @click="onClickLeft()"
        size="20"
        color="whitesmoke"
        name="arrow-left"
        class="icon"
      />
    </div>
    <br>
    
    <div class="guess_like" @click="jumpGameUpdate()">
      <br>
              <div
                @click.stop="jumpDetail(item1, index1)"
                class="guess_like_show"
                v-for="(item1, index1) in list"
                :key="index1"
              >
                <van-image
                  radius="10"
                  class="guess_like_img"
                  width="50"
                  height="50"
                  :src="item1.app_image_road"
                />
                <span class="guess_like_sp1">{{ item1.app_name }}</span>
                <span class="guess_like_sp2"
                  >下载次数：{{ item1.app_downloding_times }}</span
                >
                <van-button
                  @click.stop="downloadButton(item1, index1)"
                  class="guess_like_small"
                  size="small"
                  round
                  type="info"
                  >下载</van-button
                >
              </div>
            </div>
  </div>
</template>
<script>
import http from '../api/index'
export default {
  data() {
    return {
      list:[],
      id:this.$route.params.id
    }
  },
  mounted() {
    http.getChildrenSoft({
      app_type_id:this.$route.params.id
    }).then(r => {
      console.log(r);
      this.list=r.data;
    })

  },
  methods: {
    downloadButton(item, index) {
      window.location.href='http://whole555.oss-cn-beijing.aliyuncs.com/whole/2020/10/15/16027471177286380.apk';
      http.downloadTimes({
        app_id:item.app_id
      }).then(r => {
        console.log(r);
        item.app_downloding_times=r.data;
      })
    },
    // 跳到详情
    jumpDetail(item, index) {
      this.$router.push('/softDetails/' + item.app_id);
    },
    // 游戏更新
    jumpGameUpdate() {
      this.$router.push('/gameUpdate');
    },
    onClickLeft(){
      this.$router.push('/gameKind/1')
    }
  },
}
</script>

<style scoped>
.head {
  width: 100%;
  height: 4rem;
  background-color: rgb(108, 144, 243);
}
.text {
  text-align: center;
  font-size: 1.6rem;
  color: whitesmoke;
  line-height: 4rem;
}
.icon {
  position: absolute;
  top: 1.1rem;
  /* left: 0px; */
}
.guess_like {
  width: 96%;
  margin: 0 auto;
  border-radius: 1.5rem;
  background-color: white;
}
.guess_text {
  position: relative;
}
.guess_text_sp1 {
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  font-size: 1.6rem;
}
.guess_arrow {
  position: absolute;
  right: 1rem;
  top: 1.3rem;
  font-size: 2rem;
}
.guess_like_show {
  width: 96%;
  height: 6rem;
  position: relative;
  margin-top: 2rem;
}
.guess_like_img {
  position: absolute;
  top: 0px;
  left: 2rem;
  border-radius: 1rem;
}
.guess_like_sp1 {
  position: absolute;
  top: 0.1rem;
  left: 8.5rem;
  font-size: 1.8rem;
  color: #252525;
}
.guess_like_sp2 {
  position: absolute;
  top: 3rem;
  left: 8.5rem;
  font-size: 1.4rem;
  color: #7a7a7a;
}
.guess_like_small {
  position: absolute;
  top: 0.8rem;
  right: 0px;
  width: 7rem;
}
.good_soft_show {
  display: inline-block;
  margin-top: 2rem;
  margin-left: 4.5rem;
}
.good_soft_img {
  display: inline-block;
}
.good_soft_p1 {
  font-size: 1.6rem;
  margin-left: -0.3rem;
  margin-top: 0.5rem;
}
.foot {
  width: 100%;
  height: 10rem;
}
</style>